home *** CD-ROM | disk | FTP | other *** search
/ Inventor Labs: Technology / INVENTORLABS_TECHNOLOGY.BIN / pc / files / invest.dir / 00003_Script_Inv Lens Obj < prev    next >
Text File  |  1997-05-26  |  11KB  |  375 lines

  1. --Inv Lens Object Script
  2.  
  3. property pStartLensSpriteNum, pStartLensCastNum, pStartTopMOVCastNum
  4. property pDiagramSpriteNum, pLensPos, pObjectPos, pLens
  5. property pLensList1, pLensList2, pLastObjectPos, pMember
  6. property pLastLensPos, pDiagramStartCast, pPuppetSpriteList
  7. ---------------------------------------------------------------ò
  8. on mInit me
  9.   
  10.   set pStartLensSpriteNum = 14
  11.   set pStartLensCastNum = the number of cast "ILEL1SP.PIC"
  12.   set pStartTopMOVCastNum = the number of cast "ILECVX.mov"
  13.   set pDiagramSpriteNum = 18
  14.   set pDiagramStartCast = (the number of cast "ILECV121.8bt") - 1
  15.   set pPuppetSpriteList = [4,5,8,9,12,18]
  16.   mActivate( me )
  17.   return( me )
  18.   
  19. end mInit
  20. ---------------------------------------------------------------ò
  21. on mActivate me
  22.   
  23.   repeat with spritenum in pPuppetSpriteList
  24.     puppetSprite spritenum, true
  25.   end repeat
  26.   
  27.   --  set the castnum of sprite 12 = 95
  28.   --  set the rect of sprite 12 = the rect of sprite 13
  29.   --  updatestage
  30.   
  31.   set the movieTime of sprite 12 = 236
  32.   updatestage
  33.   
  34.   
  35.    set the rect of sprite 12 = the rect of sprite 13
  36.   --  set the locH of sprite 12 = the locH of sprite 13
  37.   --  set the locV of sprite 12 = the locV of sprite 13
  38.   --  updateStage
  39.   --  
  40.   --  updateStage
  41.     set the visible of sprite 12 = 1
  42.   
  43.   
  44.   set the visible of sprite 18 to false  
  45.   -- create list of start frames for lens movie 
  46.   set pLensList1 = list(25)
  47.   set pLensList2 = list(25)
  48.   -- initialize values for lens list
  49.   mInitLensList(me) 
  50.   -- initialize lens and object positions
  51.   set pLensPos to 1
  52.   set pObjectPos to 6
  53.   set pLastObjectPos to 6
  54.   set pLastLensPos to 1
  55.   set pLens = 1
  56.   
  57. end mActivate
  58. ---------------------------------------------------------------ò
  59. on mClose me
  60.   
  61.   repeat with x in pPuppetSpriteList
  62.     puppetSprite x, false
  63.   end repeat
  64.   set the visible of sprite 18 to true
  65.   puppetsprite 33,  false
  66.   --tj&dl
  67.   repeat with n = 2 to 20
  68.     set the puppet of sprite n = 0
  69.     set the visible of sprite n = 1
  70.   end repeat
  71.   
  72. end mClose
  73. ---------------------------------------------------------------ò
  74. on mClickLens me
  75.   
  76.   set pMember = the clickOn  
  77.   -- remember last position
  78.   --set lastLensPos to (1+((the loch of sprite 9 - 305)/60)) 
  79.   -- move the lens with the cursor
  80.   repeat while the mouseDown
  81.     put the mouseh into tempx
  82.     if tempx < 305 then
  83.       set tempx = 305
  84.     end if
  85.     if tempx > 605 then
  86.       set tempx = 605
  87.     end if
  88.     set the loch of sprite 5 to tempx
  89.     updateStage
  90.   end repeat
  91.   -- calculate the slider position (add in 30 to round off properly)
  92.   set pLensPos = 1+(tempx-275)/60
  93.   -- check to see if position is free
  94.   mCheckClash(me)
  95.   put "Lens"&&pLensPos&&pObjectPos&&pLastLensPos
  96.   -- determine closest position
  97.   set snapPos = 60*(pLensPos-1)+305
  98.   -- snap lens to set position
  99.   set the loch of sprite 5 to snapPos
  100.   -- move lens from last position to chosen position
  101.   
  102.   mMoveLens(me)
  103.   
  104.   updateStage
  105. end mClickLens
  106. ---------------------------------------------------------------ò
  107. on mTopClick me
  108.   
  109.   -- remember last position
  110.   --set pLastObjectPos to (((the loch of sprite 8 - 305)/60)+1)
  111.   
  112.   set pMember = the clickOn
  113.   
  114.   repeat while the mousedown
  115.     
  116.     put the mouseh into tempx2
  117.     
  118.     if tempx2 < 305 then
  119.       set tempx2 = 305
  120.     end if
  121.     if tempx2 > 605 then
  122.       set tempx2 = 605
  123.     end if
  124.     
  125.     set the loch of sprite 4 to tempx2
  126.     updateStage
  127.   end repeat
  128.   
  129.   -- calculate the slider position
  130.   set pObjectPos = 1+(tempx2-275)/60
  131.   
  132.   -- check to see if position is free
  133.   mCheckClash(me)
  134.   
  135.   set snapPos = 60*(pObjectPos-1)+305
  136.   set the locH of sprite 4 to snapPos
  137.   
  138.   -- move object from last position to chosen position
  139.   
  140.   mMoveObject(me)
  141.   
  142.   updateStage
  143. end mTopClick
  144. ---------------------------------------------------------------ò
  145. on mCheckClash me
  146.   
  147.   if pMember = 9 then
  148.     
  149.     if pLensPos >= pObjectPos then
  150.       set pLensPos to pLastLensPos
  151.     end if
  152.     
  153.   else
  154.     if pLensPos >= pObjectPos then
  155.       set pObjectPos to pLastObjectPos
  156.     end if
  157.   end if
  158.   
  159. end mCheckClash
  160. ---------------------------------------------------------------ò
  161. on mMoveLens me
  162.   
  163.   put "Lens"&&pLensPos&&pLastLensPos
  164.   set endPos = pLensPos
  165.   
  166.   if endPos < pLastLensPos then
  167.     set direction = -1
  168.   else
  169.     set direction = 1
  170.   end if
  171.   
  172.   -- determine the movie start and end frames for the move
  173.   -- list values are the positions in the frame matrix
  174.   set listvalue1 = (pObjectPos-2)*5+pLastLensPos
  175.   set listvalue2 = (pObjectPos-2)*5+pLensPos
  176.   
  177.   -- add offset of 604 ticks to access lens movement part of movie
  178.   if listvalue1 > count(pLensList2) then set listvalue1 = count(pLensList2)
  179.   if listvalue1 < 1 then set listvalue1 = 1
  180.   set startFrame = getAt(pLensList2,listvalue1)
  181.   if listvalue2 > count(pLensList2) then set listvalue2 = count(pLensList2)
  182.   if listvalue2 < 1 then set listvalue2 = 1
  183.   set endFrame = getAt(pLensList2,listvalue2)
  184.   
  185.   set xx = StartFrame
  186.   put "move lens"&&pLensPos&&pObjectPos&&startFrame&&endFrame
  187.   
  188.   if endFrame < startFrame then
  189.     repeat while xx > endFrame
  190.       set the movietime of sprite 12 to xx
  191.       set the loch of sprite 9 to the loch of sprite 9 + direction*4
  192.       updateStage
  193.       set xx = xx + direction*4
  194.     end repeat
  195.   else
  196.     
  197.     repeat while xx < endFrame
  198.       set the movietime of sprite 12 to xx
  199.       set the loch of sprite 9 to the loch of sprite 9 + direction*4
  200.       updateStage
  201.       set xx = xx + direction*4
  202.     end repeat
  203.     
  204.   end if
  205.   
  206.   put "last test"&&pLastLensPos&&endpos
  207.   set pLastLensPos = endpos
  208.   put "last test2 "&&pLastLensPos&&endpos
  209. end mMoveLens
  210. ---------------------------------------------------------------ò
  211. on mMoveObject me
  212.   
  213.   set endPos = pObjectPos
  214.   
  215.   if endPos < pLastObjectPos then
  216.     set direction = -1
  217.   else
  218.     set direction = 1
  219.   end if
  220.   
  221.   -- determine the movie start and end frames for the move
  222.   -- list values are the positions in the frame matrix
  223.   set listvalue1 = (pLastObjectPos-2)*5+pLensPos
  224.   set listvalue2 = (endPos-2)*5+pLensPos
  225.   
  226.   set startFrame = getAt(pLensList1,listvalue1)
  227.   set endFrame = getAt(pLensList1,listvalue2)
  228.   
  229.   put startFrame&&endframe
  230.   
  231.   set xx = StartFrame
  232.   
  233.   if endFrame < startFrame then
  234.     repeat while xx > endFrame
  235.       set the movietime of sprite 12 to xx
  236.       set the loch of sprite 8 to the loch of sprite 8 + direction*4
  237.       updateStage
  238.       set xx = xx + direction*4
  239.       
  240.     end repeat
  241.   else
  242.     
  243.     repeat while xx < endFrame
  244.       set the movietime of sprite 12 to xx
  245.       set the loch of sprite 8 to the loch of sprite 8 + direction*4
  246.       updateStage
  247.       set xx = xx + direction*4
  248.       
  249.     end repeat
  250.     
  251.   end if
  252.   
  253.   -- correction for slight offset
  254.   --set the loch of sprite 8 to the loch of sprite 8 - 2
  255.   
  256.   set pLastObjectPos = endpos
  257. end mMoveObject
  258.  
  259. ---------------------------------------------------------------ò
  260. on mInitLensList me
  261.   
  262.   -- this script puts values into the list Lenslist, which contains
  263.   -- the frame numbers in the movie "lens composite" for various lens and 
  264.   -- object positions. Internally, these lists are 5x5 grids (pObjectPos,pLensPos)
  265.   -- there are two lists, pLensList1, and pLensList2
  266.   -- pLensList1 holds the frame numbers for the animations in which the object
  267.   -- is moving
  268.   -- pLensList2 holds the frame numbers for the animations in which the lens
  269.   -- is moving.
  270.   -- all the animations are contained in the "lens composite" movie to eliminate
  271.   -- flashing (when switching movies)
  272.   
  273.   -- initialize pLensList1
  274.   setAt(pLensList1,1,0)
  275.   setAt(pLensList1,6,56)
  276.   setAt(pLensList1,7,240)
  277.   setAt(pLensList1,11,116)
  278.   setAt(pLensList1,12,296)
  279.   setAt(pLensList1,13,420)
  280.   setAt(pLensList1,16,176)
  281.   setAt(pLensList1,17,356)
  282.   setAt(pLensList1,18,476)
  283.   setAt(pLensList1,19,540)
  284.   setAt(pLensList1,21,236)
  285.   setAt(pLensList1,22,416)
  286.   setAt(pLensList1,23,536)
  287.   setAt(pLensList1,24,596)
  288.   setAt(pLensList1,25,600)
  289.   
  290.   -- initialize pLensList2
  291.   setAt(pLensList2,1,604)
  292.   setAt(pLensList2,6,608)
  293.   setAt(pLensList2,7,664)
  294.   setAt(pLensList2,11,668)
  295.   setAt(pLensList2,12,724)
  296.   setAt(pLensList2,13,784)
  297.   setAt(pLensList2,16,788)
  298.   setAt(pLensList2,17,844)
  299.   setAt(pLensList2,18,904)
  300.   setAt(pLensList2,19,964)
  301.   setAt(pLensList2,21,968)
  302.   setAt(pLensList2,22,1024)
  303.   setAt(pLensList2,23,1084)
  304.   setAt(pLensList2,24,1144)
  305.   setAt(pLensList2,25,1204)
  306. end mInitLensList
  307. ---------------------------------------------------------------ò
  308. on mResetTrack me
  309.   
  310.   set the loch of sprite 8 to (pObjectPos-1)*60+305
  311.   set the loch of sprite 9 to (pLensPos-1)*60+305
  312.   set the loch of sprite 4 to the loch of Sprite 8
  313.   set the loch of sprite 5 to the loch of sprite 9
  314.   
  315.   updateStage
  316. end mResetTrack
  317. ---------------------------------------------------------------ò
  318. on mLensClickEvent me, aTopQTcastIndex, aLensNum
  319.   
  320.   --aTopQTcastIndex is 0 or 1
  321.   --aLensNum is 1, 2, 3, or 4
  322.   
  323.   set LensIndex = the clickon - pStartLensSpriteNum 
  324.   global pLensPos,pObjectPos,pLastLensPos,pLastObjectPos
  325.   set the castnum of sprite 9 to pStartLensCastNum + LensIndex
  326.   set the castnum of sprite 5 to pStartLensCastNum + LensIndex + 4
  327.   set the castnum of sprite 12 to pStartTopMOVCastNum + aTopQTcastIndex
  328.   set pLensPos = 1
  329.   set pObjectPos = 6
  330.   set pLastLensPos = 1
  331.   set pLastObjectPos = 6
  332.   set pLens = aLensNum
  333.   mResetTrack(me)
  334.   
  335. end mLensClickEvent
  336. ---------------------------------------------------------------ò
  337. on mLeftButtonPress me
  338.   
  339.   set the visible of sprite pDiagramSpriteNum = false
  340.   updateStage
  341.   
  342. end mLeftButtonPress
  343. ---------------------------------------------------------------ò
  344. on mRightButtonPress me
  345.   
  346.   set temp = (pLens-1)*15+pDiagramStartCast--\
  347.   
  348.   put temp + pObjectPos-1
  349.   
  350.   if pLensPos = 1 then
  351.     set the castnum of sprite pDiagramSpriteNum to temp + pObjectPos-1
  352.   end if
  353.   
  354.   if pLensPos = 2 then
  355.     set the castnum of sprite pDiagramSpriteNum to temp + 5 + pObjectPos-2
  356.   end if
  357.   
  358.   if pLensPos = 3 then 
  359.     set the castnum of sprite pDiagramSpriteNum to temp + 9 + pObjectPos-3
  360.   end if
  361.   
  362.   if pLensPos = 4 then
  363.     set the castnum of sprite pDiagramSpriteNum to temp + 12 + pObjectPos-4
  364.   end if
  365.   
  366.   if pLensPos = 5 then
  367.     set the castnum of sprite pDiagramSpriteNum to temp + 14 + pObjectPos-5
  368.   end if
  369.   
  370.   
  371.   set the visible of sprite pDiagramSpriteNum to true
  372.   updateStage
  373.   
  374. end mRightButtonPress
  375. ---------------------------------------------------------------ò